<%@page import="com.farm.wcp.pojo.FileInformation"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib uri="/view/conf/farmtag.tld" prefix="PF"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>演示-<PF:ParameterValue key="config.sys.title" /></title>
    
	<meta name="description"
	content='<PF:ParameterValue key="config.sys.mate.description"/>'>
	<meta name="keywords"
		content='<PF:ParameterValue key="config.sys.mate.keywords"/>'>
	<meta name="author"
		content='<PF:ParameterValue key="config.sys.mate.author"/>'>
	<meta name="robots" content="index,follow">
	<jsp:include page="../web-simple/atext/include-web.jsp"></jsp:include>
 </head>
  
  <body>
    <jsp:include page="../web-simple/commons/head.jsp"></jsp:include>
    <jsp:include page="../web-simple/commons/superContent.jsp"></jsp:include>
    <div class="containerbox">
		<div class="container">
		  <div class="row clearfix">
			<div class="col-sm-12">			 			  
			  <div class="col-sm-10 col-sm-offset-1"> 
			  	<div class="col-sm-12 well">
			  		<a href="webonline/publish.do"><button class="btn btn-primary pull-right">创建文档</button></a>
			  	</div> 			  
			  	<table class="table table-hover" id="list">
			  		<thead>
			  			<tr><td><b>序号</b></td><td><b>作者</b></td><td><b>标题</b></td><td><b>发表时间</b></td><td><b>最后修改时间</b></td><td><b>下载</b></td></tr>
			  		</thead>
			  		<tbody>
						<c:forEach var="file" items="${ fileInformations}" varStatus="index">
							<tr class='success'><td>${index.index}</td><td>${file.author}</td><td><a class='btn-link' href="${file.url}">${file.title}</a></td><td>${file.cTime}</td><td><span>${file.uTime}<span></td><td><span><a title="点击下载" class=" btn btn-link" href="${file.zipUrl}"><span class="glyphicon glyphicon-download-alt">下载</span></a><span></td></tr>
						</c:forEach>	  		  				  					  		 	 
			  		</tbody>
			  	</table>			  	
			  	<div class="col-sm-12 well">
			  		<div class="easyui-panel text-center">
					<div id="pp" style="background:#efefef;border:1px solid #ccc;"></div>						
					</div>
			  	</div> 
			  </div>
		    </div>				
		  </div>			
		</div>
	</div>
	<jsp:include page="../web-simple/commons/footServer.jsp"></jsp:include>
	<jsp:include page="../web-simple/commons/foot.jsp"></jsp:include>
  </body>
  <script type="text/javascript">
  function get(page,size,type){
  				var url='webonline/PubPageTypeData/'+page+'/'+size+'.do'; 				
  				var countUrl='webonline/PubPageTypeCountData.do';  				 				 				
   				var count; 
   				 $.ajax({
   				 url:countUrl,
   				 async:false,
   				 data:{type:type},
   				 cache:true,
   				 type:'post',
   				 success:function(result){       				  		 								  				      
					  count=$.parseJSON( result).length;
   				 }});
   				 //post 默认为异步，不合需求 				
   			/*	$.post(countUrl,{type:type},function(result){  
   				alert($.parseJSON( result).length)         ;    		 								  				      
					  count=$.parseJSON( result).length;
				});	*/				
  				$.post(url,{type:type},function(result){	
  					  $('#list tbody').empty();							  				      
					  $.each($.parseJSON( result), function(k, v){					  		
               		 		 $('#list tbody').append('<tr class=\'success\'><td>'+k+'</td><td>'+v.author+'</td><td><a class=\'btn-link\' href='+v.url+'>'+v.title+'</a></td><td>'+v.cTime+'</td><td><span>'+v.uTime+'<span></td><td><span><a title=\'点击下载\' class=\' btn btn-link\' href='+v.zipUrl+'><span class=\'glyphicon glyphicon-download-alt\'>下载</span></a><span></td></tr>');
            			});
				});	
				//url = url.substring(0,url.lastIndexOf("/"));
				//url = url.substring(0,url.lastIndexOf("/")); 
  				 $('#pp').pagination({
				        total:count,
				        pageSize:size,
				        showPageList:true,
				        showRefresh:false,
				        beforePageText:'第',
				        afterPageText:'页，共{pages}页',
				        displayMsg:'显示 {from} 到 {to} 条记录， 共 {total}条 页面信息。',
				        onSelectPage:function(pageNumber, pageSize){				      				        	
				        	 get(pageNumber,pageSize,type);				        	
				        }				       
				});
  	
  
  }            
  </script>
</html>
			  		